package proxy.jdk;

import org.aopalliance.intercept.MethodInterceptor;

import java.lang.reflect.Proxy;

public class ProxyStar{

    private Object star;

    public ProxyStar(Star star){
        this.star = star;
    }

    public Object getProxyInstance(){
        return Proxy.newProxyInstance(star.getClass().getClassLoader(), star.getClass().getInterfaces(), (proxy, method, args) -> {
            System.out.println("啊~~你在哪儿");
            Object object = method.invoke(star, args);
            System.out.println("啊~~我看不见");
            return object;
        });
    }
}
